using Mysoft.Dbf.Writers;

namespace Mysoft.Dbf
{
    public class ExportAsNumericArrayAttribute : ExportToDBFAttributeBase
    {
        string _columnNameFormat;
        string _namingVariableName;
        byte _fieldSize;
        byte _decimalPlaces;
        byte _arrayLength;
        public ExportAsNumericArrayAttribute(string columnNameFormat, string variableName, byte arrayLength, byte fieldSize, byte decimalPlaces)
        {
            _columnNameFormat = columnNameFormat;
            _arrayLength = arrayLength;
            _fieldSize = fieldSize;
            _decimalPlaces = decimalPlaces;
            _namingVariableName = variableName;
        }

        public override IWriter GetWriter()
        {
            return new ArrayWriter(
                this._namingVariableName, 1, this._arrayLength,
                new NumericFieldWriter(this._columnNameFormat, this._fieldSize, this._decimalPlaces));
        }
    }
}
